package br.mg.bhe.ftpobre.command;

import br.mg.bhe.ftpobre.log.FtpLogView;
import br.mg.bhe.ftpobre.util.LogUtil;

/**
 * 
 * @author Aureliano
 */
public final class CommandFactory {
	
	private CommandFactory() {
		super();
	}
	
	public static ICommand command(Class<?> clazz) {
		try {
			return (ICommand) clazz.newInstance();
		} catch (Exception ex) {
			FtpLogView.log(ex.getMessage());
			LogUtil.getLogger(CommandFactory.class).severe(ex.getMessage());
			throw new RuntimeException(ex);
		}
	}
}